package com.exampleyyy.demoyyy.controller;

import com.exampleyyy.demoyyy.ServiceJieKou.OrderServiceJieKou;
import com.exampleyyy.demoyyy.ShiTi.Orders;
import com.exampleyyy.demoyyy.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderServiceJieKou orderservicejiekou;
    @PostMapping("/submit")
    public R<Object> submitorder(@RequestBody Orders orders){
        log.info("订单数据:{}",orders);
        if (orderservicejiekou.submit(orders) == 1) {
            return R.success(1,"下单成功",null);
        }else {
            return R.error(0,"下单失败",null);
        }
    }
    /*@PostMapping("/submit")
    public void submitorder(@RequestBody Orders orders) {
        log.info("订单数据:{}", orders);
        *//*if (orderservicejiekou.submit(orders) == 1) {
            return R.success(1, "下单成功", null);
        } else {
            return R.error(0, "下单失败", null);
        }*//*
        orderservicejiekou.submit(orders);
    }*/
}
